package com.bosssoft.ct.springcloud.service;

import com.bosssoft.ct.springcloud.pojo.dto.UserDTO;
import com.bosssoft.ct.springcloud.pojo.query.UserQuery;
import com.bosssoft.ct.springcloud.utils.http.HttpResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

/**
 * feign 用户管理业务逻辑调用接口
 *
 * @author ChenTong
 * @version 1.0
 * @date 2020/6/22 20:30
 * @copyright
 * @modified
 * @see
 * @since
 **/
@Component
@FeignClient(value = "CLOUD-ADMIN-SERVICE" ,fallback = UserHystrixFallBackService.class)
public interface UserFeignService {

    @GetMapping("/user")
    HttpResult getUsers(@SpringQueryMap UserQuery userQuery);

    @PutMapping("/user")
    HttpResult update(@RequestBody UserDTO userDTO);

    @DeleteMapping("/user/{id}")
    HttpResult delete(@PathVariable("id") Long id);

    @PostMapping("/user")
    HttpResult insert(@RequestBody UserDTO userDTO);

    @GetMapping("/test/ok")
    HttpResult ok();

    @GetMapping("/test/timeout")
    HttpResult testTimeout();

    @GetMapping("/test/error")
    HttpResult error();


}
